using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using MBMC.Paths;

namespace MBMC.Dialogs
{
    public partial class CustomMissions : Form
    {
        string mbfolder;
        MBMC.Paths.Paths p;
        public CustomMissions(string actualmbfolder)
        {
            InitializeComponent();
            mbfolder = actualmbfolder;
            p = new MBMC.Paths.Paths();
        }

        private void CustomMissions_Load(object sender, EventArgs e)
        {
            System.IO.DirectoryInfo di = new System.IO.DirectoryInfo(p.Vrat_Cestu(mbfolder, MBPaths.FMDMCustomMissions));
            foreach (System.IO.FileInfo file in di.GetFiles("*.mis"))
            {
                Console.WriteLine("{0}, {1}, {2}", file.Name, file.Length, file.Extension);
                listBox1.Items.Add(file.Name);
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            PrimitiveEditor pe = new PrimitiveEditor(p.Vrat_Cestu(mbfolder, MBPaths.FMDMCustomMissions) + "/" + listBox1.SelectedItem.ToString());
            pe.Show();
        }

        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            label2.Text = "Name: " + listBox1.SelectedItem.ToString();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}